<?php
$title = 'Find a client';
$this->headTitle($title);
?>
<h1><?php echo $this->escapeHtml($title); ?></h1>
<?php echo $this->form()->render($this->form); ?>
<?php if ($post): ?>
    <table class="table">
        <tr>
            <th>ClientId</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Phone</th>
            <th>&nbsp;</th>
        </tr>
        <?php foreach ($clients as $client) : ?>
            <tr>
                <td><?php echo $this->escapeHtml($client->getId()); ?></td>
                <td><?php echo $this->escapeHtml($client->getFirstName()); ?></td>
                <td><?php echo $this->escapeHtml($client->getLastName()); ?></td>
                <td><?php echo $this->escapeHtml($client->getPhone()); ?></td>
                <td>
                    <a href="<?php echo $this->url('reportticket', array('action' => 'history', 'id' => $client->getId()));
            ?>">View ticket history</a>
                </td>
            </tr>
        <?php endforeach; ?>
        <?php if (empty($clients)): ?>
            <tr>
                <td colspan="5">No results<br><a href="<?php echo $this->url('client', array('action' => 'add',)); ?>">Add a new client</a></td>
            </tr>
    <?php endif; ?>
    </table>
<?php endif; ?>